package com.mb.app.controller;

import com.alibaba.fastjson.JSONObject;
import com.mb.app.service.ITbApiCallLogService;
import com.mb.common.controller.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 * 平台API调用记录  前端控制器
 * 日活统计
 * </p>
 *
 * @author zwl
 * @since 2019-05-27
 */
@Controller
@RequestMapping("/app/apicall")
@Slf4j
public class TbApiCallLogController extends BaseController {

    @Autowired
    private ITbApiCallLogService apiCallLogService;

    @GetMapping("/index")
    String index(Model model){
        return "/app/apicall/apicall_list";
    }

    /**
     * 日活统计
     * @param
     * @return
     * @author dong
     * @date 2018-08-31 14:21:07
     */
    @ResponseBody
    @GetMapping("/dayStatistic")
    public String dayStatistic(String month) {

        JSONObject resp = apiCallLogService.dayStatistic(month);

        log.info("resp----------------->" + resp);
        return resp.toJSONString();
    }

}
